#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3f;

void solve()
{
	int n;
	cin >> n;
	string t = "1";
	vector<int> ans;
	for (int i = 1; i <= 18; i++)
	{
		t += '0';
		int tt = stoll(t);
		if (n % (tt + 1) == 0) ans.push_back(n / (tt + 1));
	}
	sort(ans.begin(), ans.end());
	cout << ans.size() << endl;
	if (ans.size() == 0) return;
	for (auto e : ans) cout << e << ' ';
	cout << endl;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int _ = 1;
	cin >> _;
	while (_--)
	{
		solve();
	}
	return 0;
}